﻿<UserControl x:Class="Agnes.MyDocsLib.ArticleView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http: //schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Agnes.MyDocsLib"
             xmlns:ext="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
             xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/richedit"
             xmlns:cal="http://www.caliburnproject.org" 
             xmlns:csla="clr-namespace:Csla.Xaml;assembly=Csla.Xaml"
             xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/core"
             xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
             xmlns:core="clr-namespace:Agnes.Core;assembly=Agnes.Core"
             x:Name="ArticleViewControl"
             FontFamily="Courier New"
             FontSize="15" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars">
    <Grid x:Name="MainGrid">
        <Grid.Resources>
            <core:TrueToCollapsedConverter x:Key="TrueCollapsedConverter" />
            <core:FalseToCollapsedConverter x:Key="FalseCollapsedConverter" />
        </Grid.Resources>
        
        <Grid.RowDefinitions>
            <RowDefinition Height="10" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="5" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="5" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="5" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="5" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="15" />
            <RowDefinition Height="*" />
            <RowDefinition Height="10" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="10" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="5" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="15" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="5" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="10" />
        </Grid.ColumnDefinitions>
    
        <!--Row1-->
        <TextBlock Grid.Row="1" Grid.Column="1" Text="标题：" VerticalAlignment="Center"/>
        <StackPanel Grid.Row="1" Grid.Column="3" Orientation="Horizontal">
            <dxe:TextEdit MinWidth="100"
                          AllowNullInput="False" NullText="请输入文章标题..."
                          Visibility="{Binding Path=IsEditMode, Mode=TwoWay, Converter={StaticResource FalseCollapsedConverter}}"
                          VerticalAlignment="Center"
                          Text="{Binding Model.Title, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"/>
            <csla:PropertyStatus Property="{Binding Model.Title}" Margin="3,0,0,0"/>    
        </StackPanel>
        <TextBlock Grid.Row="1" Grid.Column="3" VerticalAlignment="Center"
                   Text="{Binding Model.Title}"
                   Visibility="{Binding Path=IsEditMode, Mode=TwoWay, Converter={StaticResource TrueCollapsedConverter}}" />
    
        <!--Row2-->
        <TextBlock Grid.Row="3" Grid.Column="1" Text="分类：" VerticalAlignment="Center" />
        <TextBlock Grid.Row="3" Grid.Column="3" VerticalAlignment="Center" Text="{Binding Model.CatalogPath}"/>
        
        <!--Row3-->
        <TextBlock Grid.Row="5" Grid.Column="1" Text="标签：" VerticalAlignment="Center" />
        <dxe:TextEdit Grid.Row="5" Grid.Column="3" AllowNullInput="True" NullText="每个标签以;分割"
                      Visibility="{Binding Path=IsEditMode, Mode=TwoWay, Converter={StaticResource FalseCollapsedConverter}}"
                      VerticalAlignment="Center"
                      Text="{Binding Model.Labels, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"/>
        <TextBlock Grid.Row="5" Grid.Column="3" VerticalAlignment="Center"
                   Text="{Binding Model.Labels}"
                   Visibility="{Binding Path=IsEditMode, Mode=TwoWay, Converter={StaticResource TrueCollapsedConverter}}" />

        <!--Row4-->
        <TextBlock Grid.Row="7" Grid.Column="1" Text="创建时间：" VerticalAlignment="Center"
                   Visibility="{Binding Path=IsEditMode, Mode=TwoWay, Converter={StaticResource TrueCollapsedConverter}}"/>
        <TextBlock Grid.Row="7" Grid.Column="3" Text="{Binding Model.CreateDT}"
                   Visibility="{Binding Path=IsEditMode, Mode=TwoWay, Converter={StaticResource TrueCollapsedConverter}}"/>
        <TextBlock Grid.Row="7" Grid.Column="5" Text="浏览次数：" VerticalAlignment="Center"
                   Visibility="{Binding Path=IsEditMode, Mode=TwoWay, Converter={StaticResource TrueCollapsedConverter}}"/>
        <TextBlock Grid.Row="7" Grid.Column="7" Text="{Binding Model.PreviewCount}"
                   Visibility="{Binding Path=IsEditMode, Mode=TwoWay, Converter={StaticResource TrueCollapsedConverter}}"/>
        
        <!--Row5-->
        <TextBlock Grid.Row="9" Grid.Column="1" Text="更新时间：" VerticalAlignment="Center"
                   Visibility="{Binding Path=IsEditMode, Mode=TwoWay, Converter={StaticResource TrueCollapsedConverter}}"/>
        <TextBlock x:Name="tbUpdateDT" Grid.Row="9" Grid.Column="3" Text="{Binding Model.UpdateDT}"
                   Visibility="{Binding Path=IsEditMode, Mode=TwoWay, Converter={StaticResource TrueCollapsedConverter}}"/>
        
        <!--Row6-->
        <Grid Grid.Row="11" Grid.Column="1" Grid.ColumnSpan="8">
            <dxr:RichEditControl x:Name="recRichEdit"
                                 MaxWidth="{Binding ElementName=MainGrid,Path=Width,Mode=OneWay}"
                                 ActiveViewType="Simple" 
                                 ShowHoverMenu="True"></dxr:RichEditControl>
        </Grid>
     </Grid>
</UserControl>
